package com.starlink.model.util;

import com.starlink.model.dtomapper.MallBooksOrderDetailsDtoMapper;
import com.starlink.model.domain.MallBooksOrderDetailsDO;
import com.starlink.model.vo.MallBooksOrderDetailsVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class MallBooksOrderDetailsConvert {

    public static List<MallBooksOrderDetailsVO> buildMallBooksOrderDetailsVoList(List<MallBooksOrderDetailsDO> mallBooksOrderDetailsDOList) {
        if (CollectionUtils.isEmpty(mallBooksOrderDetailsDOList)) {
            return Lists.newArrayList();
        }
        List<MallBooksOrderDetailsVO> mallBooksOrderDetailsVOList = new ArrayList<>();
        for (MallBooksOrderDetailsDO mallBooksOrderDetailsDO : mallBooksOrderDetailsDOList) {
            mallBooksOrderDetailsVOList.add(MallBooksOrderDetailsDtoMapper.INSTANCE.do2VO(mallBooksOrderDetailsDO));
        }

        return mallBooksOrderDetailsVOList;
    }
}
